StepList
StepList List()
 
Parameters:

    List() = The Type list handle within which you wish to move forward
Returns: NONE
 

      The StepList() function steps current position index to next link within the linked list.





FACTS:


      * StepList is short hand for SetListPos GetListNext(Mylist())

      * Don't know what a linked list is ?, make sure you read the Linked list tutorial then.





Mini Tutorial:


      This example creates a list of three people, then runs through the list manually and displays each persons names and their list position.

  
; Declare the "Person" user defined type.
  Type Person
   ; These Fields will hold this persons name
     FirstName$
     SurName$
  EndType
  
;  Dimension the Friends variable of type Person,
; with linked list support
  Dim  Friends As Person List
  
  
; Add a person (Billy) to Friends list
  Friends= New Person
  Friends.FirstName$ ="Billy"
  Friends.Surname$ ="Citizen"
  
  
; Add another person (Sally) to Friends list
  Friends= New Person
  Friends.FirstName$      ="Sally"
  Friends.Surname$           ="Stevens"
  
; Add another person (Sally) to Friends list
  Friends= New Person
  Friends.FirstName$      ="Olivia"
  Friends.Surname$           ="Dude"
  
  
  
; Reset the List current index of this list ot the FIRST
; in the list
  ResetList Friends()
  
;Enter a while loop, but only while the current list position
; ifn't at the end of the list
  While Not EndOfList(Friends())
     
   ; Display this persons name
     Print Friends.FirstName$+" "+Friends.Surname$
     Print ""
     
   ; Move the current list pointer to the next link
   ; in the list.
     StepList Friends()
     
  EndWhile
  
; display the screen and wait for a key press
  Sync
  WaitKey
  
  




This example would output.

  
  Olivia Dude
  
  Sally Stevens
  
  Billy Citizen
  
  

 
Related Info: Each | EndOfList | GetListPos | LinkedLists | List | NewList :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com